﻿namespace DoNet.OAuth2
{
    public abstract class OAuthBase
    {
        /// <summary>
        /// 平台
        /// </summary>
        public abstract OAuthServer Platform
        {
            get;
        }
        /// <summary>
        /// 
        /// </summary>
        public string AppKey = string.Empty;
        /// <summary>
        /// 
        /// </summary>
        public string AppSecret = string.Empty;
        /// <summary>
        /// 回调地址
        /// </summary>
        public string CallbackUrl = string.Empty;

        #region 基础属性
        /// <summary>
        /// 返回的开放ID。
        /// </summary>
        public string openID = string.Empty;
        /// <summary>
        /// 访问的Token
        /// </summary>
        public string token = string.Empty;
        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTime expiresTime;
        /// <summary>
        /// 第三方账号昵称
        /// </summary>
        public string nickName = string.Empty;
        /// <summary>
        /// 第三方账号头像地址
        /// </summary>
        public string headUrl = string.Empty;
        /// <summary>
        /// 首次请求时返回的Code
        /// </summary>
        public string code = string.Empty;

        #endregion

        /// <summary>
        /// 获取Authorization Code 的URL
        /// </summary>
        /// <returns></returns>
        public abstract string GetAuthorizeURL();

        /// <summary>
        /// 获取是否通过授权。
        /// </summary>
        public abstract bool Authorize();
    }
}
